package by.vdl.websort.controllers;

import by.vdl.websort.server.entity.UserDTO;
import org.springframework.stereotype.Controller;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import java.util.Map;

/**
 * Created with IntelliJ IDEA.
 * User: zeor
 * Date: 21.11.13
 * Time: 23:41
 * To change this template use File | Settings | File Templates.
 */
@Controller
public class RegisterController extends AbstractController {
    @RequestMapping(value={"/registerUser"}, method= RequestMethod.GET, params="new")
    public String getRegisterUserGet(Map<String, Object> model){
        model.put("userModel", new UserDTO());
        return "registerUser";
    }

    /*@RequestMapping(value="/registerUser", method=RequestMethod.POST)
    public String getRegisterUserPost(UserDTO userModel, BindingResult bindingResult){

        if(bindingResult.hasErrors()){
            return "registerUser?new";
        }

        userModel.setIp("127.0.0.1");
        userModel.setHash(String.valueOf(userModel.getName().hashCode()));


        //getCommonDao().getUserDao().save(userModel);

        return "redirect:/indexPage";
    }   */
}
